// pages/indent/indent.js
Page({
  data: {
    currentId: '1',
    section: [{
      name: '全部',
      typeId: '1'
    }, {
      name: '待付款',
      typeId: '2'
    }, {
      name: '待发货',
      typeId: '3'
    },
    {
      name: '待收货',
      typeId: '4'
    },
    {
      name: '待评价',
      typeId: '5'
    }
    ],
    cart:[{
      lu_date:"2020-01-22",
      num:1,
      lu_id:1,
      lu_status:"0",
      checked:false,
      lu_price:'168.00',
      lu_name:"泸宝原窖升30",
      lu_capacity:"500ml/瓶",
      lu_small_logo:"//img12.360buyimg.com/ddimg/jfs/t1/129153/40/13064/11623/5f686469E80548dde/6dafd0493211c445.png",
    },{
      lu_date:"2020-05-22",
      num:2,
      lu_id:2,
      lu_status:"0",
      checked:false,
      lu_price:'188.00',
      lu_name:"泸宝原窖经典",
      lu_capacity:"500ml/瓶",
      lu_small_logo:"//img11.360buyimg.com/ddimg/jfs/t1/127912/16/13040/11234/5f686469E6af166e0/15f1038b13a29556.png",
    },{
      lu_date:"2020-11-12",
      num:6,
      lu_id:3,
      checked:false,
      lu_status:"1",
      lu_price:'198.00',
      lu_name:"泸宝原窖红典",
      lu_capacity:"500ml/瓶",
      lu_small_logo:"//img14.360buyimg.com/ddimg/jfs/t1/154191/13/457/11044/5f686469E5374cda9/31ad5f49de0cce19.png",
    },
    {
      lu_date:"2020-11-12",
      num:6,
      lu_id:3,
      checked:false,
      lu_status:"2",
      lu_price:'198.00',
      lu_name:"泸宝原窖红典",
      lu_capacity:"500ml/瓶",
      lu_small_logo:"//img14.360buyimg.com/ddimg/jfs/t1/154191/13/457/11044/5f686469E5374cda9/31ad5f49de0cce19.png",
    },
    {
      lu_date:"2019-05-02",
      num:6,
      lu_id:3,
      checked:false,
      lu_status:"3",
      lu_price:'198.00',
      lu_name:"泸宝原窖红典",
      lu_capacity:"500ml/瓶",
      lu_small_logo:"//img14.360buyimg.com/ddimg/jfs/t1/154191/13/457/11044/5f686469E5374cda9/31ad5f49de0cce19.png",
    },
  ],
  indent: [
    {
      indent:123,//订单号
      info:[          //商品信息
        {
          "price":'168',  //单价
          "size":'500ml',//规格
          "type":'经典版',//类型
          "quantity":'5', //数量
        }
      ],
      status:0 //商品状态(未付款/已发货/.../.../ )
    }
  ],
  },

  payment:function(){
    console.log("支付");
    wx.navigateTo({
      url: '../orders/orders',
    })
  },
//点击每个导航的点击事件
  handleTap: function(e) {
    let id = e.currentTarget.id;
    if(id){
      this.setData({
        currentId:id,
        tapTime:''
      })
    }
  },
  cancel:function(){
    var nowTime = new Date();
    if (nowTime - this.data.tapTime < 1000) {
        console.log('阻断')
        return;
    }
    this.setData({ tapTime: nowTime });
    wx.showModal({
      title: '提示',
      content: '确定要取消订单吗？',
      success: function (res) {
        if (res.confirm) {//这里是点击了确定以后
          console.log('用户点击确定')
        } else {//这里是点击了取消以后
          console.log('用户点击取消')
        }
      }
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log("页面加载");
    
    this.setData({
      currentId:options.id
    })
   
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    // let app = pay()
    // app.onLaunch()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})